1 Football graph

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

library(geomnet)
library(plotly)
data("football")
# data step: merge vertices and edges
ftnet <- fortify(as.edgedf(football$edges), football$vertices)

# create data plot
gg <- ggplot(data = ftnet,
       aes(from_id = from_id, to_id = to_id)) +
  geom_net(layout.alg = 'fruchtermanreingold',
    aes(colour = value, group = value,
        linetype = factor(same.conf != 1)),
    linewidth = 0.1,
    size = 3, vjust = -0.75, alpha = 0.1) +
  theme_net() +
  theme(legend.position = "bottom") +
  scale_colour_brewer("Conference", palette = "Paired")  +
  guides(linetype = FALSE)
ggplotly(gg)

2 Sigmanet

library(igraph)
library(sigmaNet)
data(lesMis)

clust <- cluster_edge_betweenness(lesMis)$membership
V(lesMis)$group <- clust

layout <- layout_with_fr(lesMis)

sig <- sigmaFromIgraph(lesMis, layout = layout) %>%
  addNodeLabels(labelAttr = 'label') %>%
  addEdgeSize(sizeAttr = 'value', minSize = .1, maxSize = 2) %>%
  addNodeSize(sizeMetric = 'degree', minSize = 2, maxSize = 8) %>%
  addNodeColors(colorAttr = 'group', colorPal = 'Set1')
sig